package homelesspartners.client.model;

import java.io.Serializable;

/**
 * POJO for thank you notes
 * 
 * @author Greg Ashby
 *
 */
public class ThankYou implements Serializable {

	private static final long serialVersionUID = 1L;

	private static final String SPACE = " ";
	
	private String thankyou = null;
	private String title = null;
	private int id = -1;

	public String getTitle() {
		return title;
	}

	public void setTitle(String aTitle) {
		this.title = aTitle;
	}

	public int getId() {
		return id;
	}

	public void setStoryId(int storyId) {
		this.id = storyId;
	}

	public String getThankyou() {
		return thankyou;
	}

	public void setThankyou(String aThankYou) {
		this.thankyou = aThankYou;
	}
	
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append(id);
		buffer.append(SPACE);
		buffer.append(title);
		buffer.append(SPACE);
		buffer.append(thankyou);
		return buffer.toString();
	}

	public boolean equals(Object obj) {
		ThankYou compared = (ThankYou) obj;
		if (this.getId() == compared.getId()) {
			return true;
		}
		return false;
	}

	public String validate() {
		if(title == null || title.length() < 3){
			return "The header must be longer than 3 characters";
		} if (thankyou == null || thankyou.length() < 5){
			return "The note must be at least 5 characters long";
		}
		return null;
	}

	
}
